package com.github.binarywang.demo.wx.miniapp.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

/**
 *  json响应
 * @author guoyb
 * @date   2020/1/7 11:37
 */
public class ResponseUtil {

    public static void write(HttpServletResponse response, Object o)throws Exception{
        //想前端输出数据
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out=response.getWriter();
        out.println(o.toString());
        //刷新
        out.flush();
        out.close();
    }
}
